﻿using System;
using EraNet.Core;
using EraNet.Core.Model.Account;
using EraNet.Core.Model.SysManage;
using System.Collections.Generic;

namespace EraNet.Services.Account
{
    public partial interface IMemberService
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        int InsertMember(Member model);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        int DeleteMember(int userId);

         /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="Member">用户实体</param>
        /// <returns>0-〉更新失败 1-〉更新成功</returns>
        int UpdateMember(Member member);
        
        /// <summary>
        /// 根据ID获取用户信息
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Member GetMemberById(int userId);

        /// <summary>
        /// 根据用户名获取信息
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        Member GetMemberByName(string userName);

        /// <summary>
        /// 根据用户名获取信息
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        Member GetMemberByName(string userName, int schoolId);

        /// <summary>
        /// 根据用户名获取用户 模糊查询
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        List<Member> GetLikeMemberByName(string userName, int schoolId);
        

         /// <summary>
        /// 根据身份证获取用户
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        Member GetMemberByIdCard(string IdCard, int schoolId);
        
        /// <summary>
        /// 根据用户名和密码获取用户信息
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="Password"></param>
        /// <returns>0-〉登陆失败  1.登陆成功  2->用户名不存在 3-〉用户密码错误 </returns>
        Member GetMember(string userName, string passwordout,out int result);


          /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="Password"></param>
        /// <returns>0-〉登陆失败  5.登陆成功  6->用户名不存在 7-〉用户密码错误 8->用户名为空或者格式错误  9->密码为空或者格式错误 10-〉用户被锁定或者过期</returns>
        Member GetMemberByCard(string userName, string password, string salt, out int result);
        

        /// <summary>
        /// 分页获取用户信息
        /// </summary>
        /// <param name="RegTime"></param>
        /// <param name="EndTime"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="showHidden"></param>
        /// <returns></returns>
        IPagedList<Member> GetAllMember(DateTime? regTime, DateTime? endTime, int pageSize, int pageIndex,bool showHidden=false);

        IPagedList<Member> GetMemberBySchool(int schoolId, int pageSize, int pageIndex, bool showHidden = false);
        

        /// <summary>
        /// 根据条件获取指定ID下的学员
        /// </summary>
        /// <param name="RegTime"></param>
        /// <param name="EndTime"></param>
        /// <param name="SchoolId"></param>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="showHidden"></param>
        /// <returns></returns>
        IPagedList<Member> GetMemberBySchool(DateTime? regTime, DateTime? endTime,int schoolId, int pageSize, int pageIndex, bool showHidden = false);

         /// <summary>
        /// 用户注册  生成新的学员并在卡片分配记录表插入相关联的信息
        /// </summary>
        /// <param name="model">信息类，默认情况下，会采用用户的身份证作为用户名和密码</param>
        /// <param name="isSchool">学习卡是否关联驾校</param>
        /// <returns>0->失败  1-〉成功 2-〉用户存在或者身份证存在  5-〉用户名格式错误</returns>
        int RegisterMember(Member model, SysCards card,int SchoolId,bool isSchool);
        

        /// <summary>
        /// 获取登录学员实体
        /// </summary>
        /// <returns></returns>
        Member GetLoginMember();

        

        #region MemberAdj
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        int UpdateMemberAdj(MemberAdj model);
        /// <summary>
        /// 根据用户ID获取用户配置
        /// </summary>
        /// <param name="memberId"></param>
        /// <returns></returns>
        MemberAdj GetMemberAdjById(int memberId);
        #endregion
    }
}
